<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:s="http://sduept.security.el/func"
	xmlns:p="http://primefaces.org/ui" template="/template/template.xhtml">
	<ui:define name="head">
		<title>往期故障反馈</title>
		<link rel="stylesheet"
			href="/resources/plugins/datatables/dataTables.bootstrap.css" />
		<style>
iframe {
	width: 100%;
	height: 600px;
}

.ui-datalist-empty-message {
	/* height: 100px; */
	min-height: 100px;
}

.ui-datalist-content {
	/* height: 100px; */
	min-height: 100px;
}

.ui-datatable-scrollable-header-box {
	margin-left: 0px;
	margin-right: 15px !important;
}
</style>
	</ui:define>
	<ui:define name="content">
		<p:confirmDialog global="true" showEffect="fade" hideEffect="fade">
			<p:commandButton value="是" type="button"
				styleClass="ui-confirmdialog-yes" icon="ui-icon-check" />
			<p:commandButton value="否" type="button"
				styleClass="ui-confirmdialog-no" icon="ui-icon-close" />
		</p:confirmDialog>
		<div id="headDiv" class="box box-solid with-border">
			<h:form id="headForm">
				<div class="box-header" id="queryDiv">
					<p:outputLabel for="start" value="故障时间：" />
					<p:calendar id="start" navigator="true"
						value="#{faultFeedbackController.queryDate1}" pattern="yyyy-MM-dd"
						maxdate="Date()">
					</p:calendar>
					<p:outputLabel for="end" value="至 "
						style="margin-right:5px;margin-left:5px;" />
					<p:calendar id="end" navigator="true"
						value="#{faultFeedbackController.queryDate2}" pattern="yyyy-MM-dd"
						maxdate="Date()">
					</p:calendar>
					<p:commandButton value="查询" update="form:dataTb toolbar"
						icon="ui-icon-search" oncomplete="getTableScrollHeight();"
						actionListener="#{faultFeedbackController.queryByTime}"
						style="margin-left:5px;">
					</p:commandButton>
					<p:commandButton icon="ui-icon-refresh" value="重置"
						actionListener="#{faultFeedbackController.resetQuery}"
						oncomplete="getTableScrollHeight();"
						update=" start end form:dataTb toolbar" style="margin-left:5px;" />
				</div>
				<div id="toolbarDiv">
					<p:toolbar id="toolbar">
						<p:growl id="msgs" showDetail="true" />
						<f:facet name="left">
							<p:commandButton value="新建" icon="ui-icon-document"
								update="editForm:createDlg"
								actionListener="#{faultFeedbackController.preCreate}"
								oncomplete="PF('createDlg').show()"
								rendered="#{s:hasPermission(session,'bhyx_bhrb_wqdwgzfk_xj')}" />
							<p:commandButton
								actionListener="#{faultFeedbackController.preEdit}"
								update="editForm:createDlg" oncomplete="PF('createDlg').show()"
								icon="ui-icon-pencil" value="编辑"
								disabled="#{faultFeedbackController.selected == null}"
								rendered="#{s:hasPermission(session,'bhyx_bhrb_wqdwgzfk_bj')}">
							</p:commandButton>
							<p:commandButton value="删除" icon="ui-icon-trash"
								update="form:dataTb toolbar"
								oncomplete="getTableScrollHeight();"
								actionListener="#{faultFeedbackController.delete}"
								disabled="#{faultFeedbackController.selected == null}"
								rendered="#{s:hasPermission(session,'bhyx_bhrb_wqdwgzfk_sc')}">
								<p:confirm header="提示" message="确定删除该记录吗?" icon="ui-icon-alert" />
							</p:commandButton>
						</f:facet>
					</p:toolbar>
				</div>
			</h:form>
		</div>
		<div id="infoDiv" class="box box-solid with-border">
			<h:form id="form">
				<p:dataTable id="dataTb" var="item"
					selection="#{faultFeedbackController.selected}"
					value="#{faultFeedbackController.faultFeedbacks}" rowIndexVar="ite"
					rowKey="#{item.id}" style="margin-bottom:0" emptyMessage="无记录"
					rows="20" paginator="true" scrollable="true"
					paginatorTemplate="{Customization} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
					rowsPerPageTemplate="20,50,100" paginatorPosition="bottom">
					<f:facet name="{Customization}">
						<p:outputLabel
							value="总计：#{faultFeedbackController.faultFeedbacks.size()} 条记录"
							style="margin-right:20px;"></p:outputLabel>
					</f:facet>
					<p:ajax event="rowSelectRadio" update="headForm:toolbar" />
					<!-- <p:column selectionMode="single" width="10"
						style="text-align:center" /> -->
					<p:column width="10"  style="text-align:center;"  headerText="序号 ">
						<h:outputText value="#{ite+1}" />
					</p:column>
					<p:column width="60" headerText="调管范围">
						<h:outputText value="#{item.subControlArea}" />
					</p:column>
					<p:column width="80" headerText="故障时间">
						<h:outputText value="#{item.faultTime}">
							<f:convertDateTime pattern="yyyy-MM-dd" />
						</h:outputText>
					</p:column>
					<p:column width="40" headerText="故障设备">
						<h:outputText value="#{item.faultEquiment}" />
					</p:column>
					<p:column width="60" headerText="雷击定位系统记录">
						<h:outputText style="white-space:pre-wrap;"
							value="#{item.lightningGPS}" />
					</p:column>
					<p:column width="60" headerText="巡线结果">
						<h:outputText style="white-space:pre-wrap;"
							value="#{item.linePatrolReasult}" />
					</p:column>
				</p:dataTable>
			</h:form>
			<h:form id="editForm">
				<p:dialog id="createDlg" widgetVar="createDlg"
					header="#{faultFeedbackController.created.id == null?'新建':'编辑'}"
					modal="true" width="800" height="400">
					<p:toolbar>
						<f:facet name="left">
							<p:commandButton value="保存" update="form:dataTb"
								icon="ui-icon-disk"
								oncomplete="PF('createDlg').hide();getTableScrollHeight();"
								actionListener="#{faultFeedbackController.save}" />
						</f:facet>
					</p:toolbar>
					<p:outputPanel style="width:100%;">
						<p:panelGrid style="width:100%;"
							rendered="#{not empty faultFeedbackController.created}">
							<p:row>
								<p:column>
									<p:outputLabel value="调管范围" />
								</p:column>
								<p:column>
									<p:autoComplete size="16" scrollHeight="250" dropdown="true"
										value="#{faultFeedbackController.created.subControlArea}"
										completeMethod="#{substationCompelteController.completeSubControlArea}">
									</p:autoComplete>
								</p:column>
								<p:column>
									<p:outputLabel value="故障时间" />
								</p:column>
								<p:column>
									<p:calendar
										value="#{faultFeedbackController.created.faultTime}"
										navigator="true" pattern="yyyy-MM-dd" maxdate="Date()" />
								</p:column>
							</p:row>
							<p:row>
								<p:column>
									<p:outputLabel value="故障设备" />
								</p:column>
								<p:column colspan="3">
									<p:inputText style="width:100%;"
										value="#{faultFeedbackController.created.faultEquiment}" />
								</p:column>
							</p:row>
							<p:row>
								<p:column>
									<p:outputLabel value="雷击定位系统记录" />
								</p:column>
								<p:column colspan="3">
									<p:inputTextarea rows="4" style="width:100%;"
										autoResize="false"
										value="#{faultFeedbackController.created.lightningGPS}" />
								</p:column>
							</p:row>
							<p:row>
								<p:column>
									<p:outputLabel value="巡线结果" />
								</p:column>
								<p:column colspan="3">
									<p:inputTextarea rows="6" style="width:100%;"
										autoResize="false"
										value="#{faultFeedbackController.created.linePatrolReasult}" />
								</p:column>
							</p:row>
						</p:panelGrid>
					</p:outputPanel>
				</p:dialog>
			</h:form>
		</div>
	</ui:define>
	<ui:define name="contentend">
		<script src="/resources/js/tables/singleScrollTable.js" />
	</ui:define>
</ui:composition>
